using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.Sys_Error_Log;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
using BusinessObjects;
namespace BusinessObjects.BO_GetObjects 
{
	public static class BO_Sys_Error_Log
	{
		public static DataTable SelectAll(int status)
		{
			try
			{
				BOSys_Error_Log_Select_All action = new BOSys_Error_Log_Select_All();
				usp_Sys_Error_Log_Select_All entity = new usp_Sys_Error_Log_Select_All();
				entity.STATUS = status;
				
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectTop(int rows, int status)
		{
			try
			{
				BOSys_Error_Log_Select_Top action = new BOSys_Error_Log_Select_Top();
				usp_Sys_Error_Log_Select_Top entity = new usp_Sys_Error_Log_Select_Top();
				entity.NUMBERRECORD = rows;
				entity.STATUS = status;
				
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable Search(int  error_id)
		{
			try
			{
				BOSys_Error_Log_Search action = new BOSys_Error_Log_Search();
				usp_Sys_Error_Log_Search entity = new usp_Sys_Error_Log_Search();
				entity.ERROR_ID = error_id;
				
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
		{
			try
			{
				BOSys_Error_Log_Select_WithPaged action = new BOSys_Error_Log_Select_WithPaged ();
				usp_Sys_Error_Log_Select_WithPaged entity = new usp_Sys_Error_Log_Select_WithPaged ();
				entity.STARTINDEX = startIndex;
				entity.MAXRECORDS = pageCount;
				entity.STATUS = status;
				
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Insert( int error_line, string error_message, int error_number, string error_procedure, int error_severity, int error_state, DateTime error_date, bool is_read, bool status)
		{
			try
			{
				BOSys_Error_Log_Insert action = new BOSys_Error_Log_Insert();
				usp_Sys_Error_Log_Insert entity = new usp_Sys_Error_Log_Insert();
               entity.ERROR_LINE = error_line;
               entity.ERROR_MESSAGE = error_message;
               entity.ERROR_NUMBER = error_number;
               entity.ERROR_PROCEDURE = error_procedure;
               entity.ERROR_SEVERITY = error_severity;
               entity.ERROR_STATE = error_state;
               entity.ERROR_DATE = error_date;
               entity.IS_READ = is_read;
               entity.STATUS = status;
				
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Update( Int64 error_id, int error_line, string error_message, int error_number, string error_procedure, int error_severity, int error_state, DateTime error_date, bool is_read, bool status)
		{
			try
			{
				BOSys_Error_Log_Update action = new BOSys_Error_Log_Update();
				usp_Sys_Error_Log_Update entity = new usp_Sys_Error_Log_Update();
               entity.ERROR_ID = error_id;
               entity.ERROR_LINE = error_line;
               entity.ERROR_MESSAGE = error_message;
               entity.ERROR_NUMBER = error_number;
               entity.ERROR_PROCEDURE = error_procedure;
               entity.ERROR_SEVERITY = error_severity;
               entity.ERROR_STATE = error_state;
               entity.ERROR_DATE = error_date;
               entity.IS_READ = is_read;
               entity.STATUS = status;
				
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Delete(int error_id)
		{
			try
			{
				BOSys_Error_Log_Delete action = new BOSys_Error_Log_Delete();
				usp_Sys_Error_Log_Delete entity = new usp_Sys_Error_Log_Delete();
				entity.ERROR_ID = error_id;
				
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Restore(int error_id)
		{
			try
			{
				BOSys_Error_Log_Restore action = new BOSys_Error_Log_Restore();
				usp_Sys_Error_Log_Restore entity = new usp_Sys_Error_Log_Restore();
				entity.ERROR_ID = error_id;
				
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}

